## Script (Python) "pegaObjetosContexto"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=contexto=None
##title=
##
path = contexto.getPhysicalPath()
if 'fundos' in path and len(path) > 3:
  fundo_id = path[3]
  fundo = getattr(contexto, fundo_id)
  #return fundo.Title()
  query = {}
  query['portal_type'] = ['Folder', 'EscritorioVirtualComite', 'Ploneboard', 'PloneChat']
  query['sort_on'] = 'getObjPositionInParent'
  query['review_state'] = ['published', 'private']
  query['path'] = {'query': '/'.join(fundo.getPhysicalPath()),
                   'depth': 1,
  }
  catalog = context.portal_catalog
  results = catalog(**query)
  return results

if 'fundos' in path and len(path) > 2:
  fundo_id = path[2]
  fundo = getattr(contexto, fundo_id)
  #return fundo.Title()
  query = {}
  query['portal_type'] = ['Folder', 'EscritorioVirtualSecretaria']
  query['sort_on'] = 'getObjPositionInParent'
  query['review_state'] = ['published', 'private']
  query['path'] = {'query': '/'.join(fundo.getPhysicalPath()),
                   'depth': 1,
  }
  catalog = context.portal_catalog
  results = catalog(**query)
  return results
